filechooserwidget: Pick reasonable default sidebar width
authorTimm Bäder <tbaeder@redhat.com>
Mon, 29 Apr 2019 06:40:58 +0000 (08:40 +0200)
committerTimm Bäder <mail@baedert.org>
Tue, 30 Apr 2019 03:36:20 +0000 (05:36 +0200)
The old default of 148px doesn't work everywhere. Instead, pick a
default value of -1 and measure() the sidebar widget in the
filechooserwidget in that case. Other values >= 0 are still handled as
before.

gtk/gtkfilechooserwidget.c
gtk/org.gtk.gtk4.Settings.FileChooser.gschema.xml

index aa3d9ef54a3185532486d77cbcdf1a5bc21e796b..3347ede9ca265ca34b021b2d46ce4a98fbcd2742 100644 (file)
@@ -3750,6 +3750,14 @@ settings_load (GtkFileChooserWidget *impl)
    */
 
   update_time_renderer_visible (impl);
+  if (sidebar_width < 0)
+    {
+      GtkWidget *sidebar = gtk_paned_get_child1 (GTK_PANED (priv->browse_widgets_hpaned));
+
+      gtk_widget_measure (sidebar, GTK_ORIENTATION_HORIZONTAL, -1,
+                          NULL, &sidebar_width, NULL, NULL);
+    }
+
   gtk_paned_set_position (GTK_PANED (priv->browse_widgets_hpaned), sidebar_width);
 }
 
index 713597a633338dd890c733627f0a07cb8d7d2dcc..2db786b236b94ec1fe854228f27a423e9cab3046 100644 (file)
       </description>
     </key>
     <key name='sidebar-width' type='i'>
-      <default>148</default>
+      <default>-1</default>
       <summary>Sidebar width</summary>
       <description>
        Width in pixels of the file chooser's places sidebar.